#include "BF7006AMxx_config.h"
#include "BF7006AMxx_sysctrl.h"
#include "SEGGER_RTT.h"
#include "SEGGER_RTT_Conf.h"
#include "bsp.h"
#include "power_transfer.h"

#define VERSION "0.01"


int main(void)
{
    /*
     * Multiple startup options are available in Startup -> BF7006AMxx_config.c -> Configuration Wizard
     * Please configure in Startup -> BF7006AMxx_config.c -> Configuration Wizard
     */

    config_return_status init_ret_val;

    /* system config, xtal_init() requires interrupt, so no disabling irq here*/
    system_config();

    /* Disable interrupt */
    Disable_Irq();

    /* peripherals config */
    /* Please configure in Startup -> BF7006AMxx_config.c -> Configuration Wizard */
    init_ret_val = peripherals_config();

    if(is_xtal_init_success == XTAL_Init_Status_Init_Failed)
    {
        /* xtal init error handling */

    }

    if(init_ret_val.overall == ERROR)
    {
        /* handle peripherals init error here */

    }

    /* Enable interrupt */
    Enable_Irq();

    /* Place your initialization code below */
	SEGGER_RTT_Init();
	SEGGER_RTT_SetTerminal(0);
	SEGGER_RTT_printf(0,"\r\n\r\nBaoLing Wireless Power Transfer Version : %s\r\n\r\n",VERSION);
	bsp_init();
	/* Place your initialization code above */
	
    while(1)
    {

		power_tx_handler();
		
        /* Place your code here */
#ifdef BF7x06AMxx_WDT_DRIVER_PRESENT
        wdt_clear();        // clear watchdog
#endif
    }

    /* Should never reach here */
    return 0;
}

//--------------------------END OF FILE-----------------------------------
